package exprarbre;

public class ASAMult extends ASAExpr {

    private ASAExpr e1, e2;

    public ASAMult(ASAExpr e1, ASAExpr e2) {
        this.e1 = e1;
        this.e2 = e2;
    }

    @Override
    public ASAExpr getExpr1() {
        return e1;
    }

    @Override
    public ASAExpr getExpr2() {
        return e2;
    }

    @Override
    public int evalue() {
        return e1.evalue() * e2.evalue();
    }

    @Override
    public ASAExpr simplifie() {
        ASAExpr se1 = e1.simplifie();
        ASAExpr se2 = e2.simplifie();

        if (se1 instanceof ASAEntier && se2 instanceof ASAEntier) {
            return new ASAEntier(se1.evalue() * se2.evalue());
        }

        return new ASAMult(se1, se2);
    }
}